package com.hww.gannan.controller;

import com.hww.gannan.entity.FriendlyLink;
import com.hww.gannan.entity.Message;
import com.hww.gannan.entity.SysLogin;
import com.hww.gannan.service.impl.IndexServiceImpl;
import com.hww.gannan.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;

@RestController
public class IndexController {
    @Resource
    private IndexServiceImpl indexService;

    @PostMapping("/addMessage")
    public Result addMessage(@RequestBody Message message) {
        return indexService.addMessage(message);
    }

    @PostMapping("/regist")
    public Result addSysLogin(@RequestBody SysLogin sysLogin) {
        sysLogin.setCreateTime(new Date());
        return indexService.addSysLogin(sysLogin);
    }

    @PostMapping("/login")
    public Result login(@RequestBody SysLogin sysLogin) {
        return indexService.login(sysLogin);
    }

    @GetMapping("/getUrlList")
    public Result getUrlList() {
        return indexService.getUrlList();
    }

    @GetMapping("/getDetails")
    public Result getDetails(@RequestParam Integer id) {
        return indexService.getDetails(id);
    }
}
